package com.forezp.configclient.springboot2Rabbit;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @version V1.0  </br>
 * @ClassName TopicSender </br>
 * @Description TODO  </br>
 * @Author tonywang</br>
 * @DATE 11/26/2018 11:05 AM</br>
 */
@Component
public class TopicSender {
    @Autowired
    AmqpTemplate amqpTemplate;

    public void send(String msg){
        String msg1 = "I am topic.mesaage msg======";
        System.out.println("sender1 : " + msg1);
        amqpTemplate.convertAndSend("exchange","topic.message", msg1);

        String msg2 = "I am topic.mesaages msg########";
        System.out.println("sender2 : " + msg2);
        amqpTemplate.convertAndSend("exchange", "topic.messages", msg2);
    }
}
